<?php
namespace common\components\extenders;
use yii\web\Request;
class RequestManage extends Request
{
    public function getUserIP()
    {
//        return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
        return (isset($_SERVER['HTTP_X_REAL_IP'])||isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ?(isset($_SERVER['HTTP_X_REAL_IP'])?$_SERVER['HTTP_X_REAL_IP']:$_SERVER['HTTP_X_FORWARDED_FOR']):$_SERVER['REMOTE_ADDR'];
    }

    public function getCardNUmber($length = 10){
        $min = pow(10 , ($length - 1));
        $max = pow(10, $length) - 1;
        return rand($min, $max);

    }

}
